#include <stdio.h>

//求[l, r]的和
int AddToSum(int start, int end)
{
  int sum = 0;
  //注意：for循环中不能定义变量
  int i=0;
  for (i = start; i <= end; i ++)
    sum += i;

  return sum;
}

int main()
{
  int l = 1, r = 100;

  int ans = AddToSum(l, r);
  printf("当前求和的值为：%d\r\n", ans);

  return 0;
}
